var date = new Date();
	var year = date.getFullYear();
	var month = date.getMonth()+1;
	if(month <10){
		month = '0'+month;
	}
	$(function(){
		var time = year+'-'+month;
		$("#yearMonth").val(time);
		var member = $('#member').val();
		drawEcharts(time,member);
	});
	
	function drawEcharts(time,member){
		var incomePie = echarts.init(document.getElementById("incomePie"),'westeros');
		var payPie = echarts.init(document.getElementById("payPie"),'westeros');
		var debtPie = echarts.init(document.getElementById("debtPie"),'westeros');
		var totalBar = echarts.init(document.getElementById("totalBar"),'westeros');
		$.getJSON('/gradesign/bill/incomePie?time='+time+'&member='+member,function(data){
			incomePie.setOption(data.option);
		})
		$.getJSON('/gradesign/bill/payPie?time='+time+'&member='+member,function(data){
			payPie.setOption(data.option);
		})
		$.getJSON('/gradesign/bill/debtPie?time='+time+'&member='+member,function(data){
			debtPie.setOption(data.option);
		})
		$.getJSON('/gradesign/bill/totalBar?time='+time,function(data){
			totalBar.setOption(data.option);
		})
	}
	//日期控件
	$("#yearMonth").datetimepicker({
		format: "yyyy-mm",
	    language:  'zh-CN',
	    weekStart: 1,
	    todayBtn:  1,
	    autoclose: 1,
	    todayHighlight: 1,
	    startView: 3,//日期时间选择器打开之后首先显示的视图。 可接受的值：0,1,2,3,4
	    minView: 3,//日期时间选择器所能够提供的最精确的时间选择视图。
	    forceParse: 0,
	    setEndDate : '2018-01',
	    todayHighlight: true
	})
	$('#yearMonth').datetimepicker('setEndDate', year+'-'+month);
	$('#yearMonth').datetimepicker().on('changeDate',function(){
		drawEcharts($('#yearMonth').val());
	});
//	$('#member').change(function(){
//		var member = $('#member').val();
//		var time = $('#yearMonth').val();
//		drawEcharts(time,member);
//	});	
//	$('#yearMonth').change(function(){
//		var member = $('#member').val();
//		var time = $('#yearMonth').val();
//		drawEcharts(time,member);
//	});	
	function query(){
		var member = $('#member').val();
		var time = $('#yearMonth').val();
		drawEcharts(time,member);
	}
